In networked computing systems utilizing a proxy, data requests including Uniform Resource Locators (URLs) generated by client systems are sometimes rewritten by a server based proxy or network security device so as to have all requests directed to a single source. As an example, network security can be increased by having all URLs rewritten to a network security device that has permission to request resources from a protected resource or which can redirect the requests to a public resource. In this application the network security device or server based proxy rewrites all URLs or other data requests in order to force the client system to obtain data through the network security device.
The disadvantage with this approach is that the server based proxy or network security device may be required to rewrite URLs and other network resource requests in context as part of the data being transmitted from a resource. For example, a network security device or other server based proxy may rewrite URLs in a requested web page such that the URLs received by the client system will reference the network security device rather than a protected resource. For absolute URLs within a web page such rewriting can be readily accomplished, but for relative URLs or addresses constructed from code to be executed on the client system (e.g. Java scripts, applets, or other executable code transmitted as part of the web page) accurate rewriting cannot always be accomplished. What is required is a method and system for rewriting URLs and other network resource addresses in a manner that does not require determination of the URLs prior to the request for that URL being made by a client, and which can in general relay requests to an appropriate network security device, corporate proxy, or public resource.